package net.stogi.unicore.beyond.ui.client.taskeditor.taskpreview;

import net.stogi.unicore.beyond.api.model.TaskDefinition;

import com.google.gwt.event.shared.GwtEvent;

public class TaskPreviewOpenedEvent extends GwtEvent<TaskPreviewOpenedHandler> {

	public static final GwtEvent.Type<TaskPreviewOpenedHandler> TYPE = new GwtEvent.Type<TaskPreviewOpenedHandler>();

	private TaskDefinition taskDefinition;
	
	public TaskPreviewOpenedEvent() {}

	public TaskPreviewOpenedEvent(TaskDefinition taskDefinition) {
		this.taskDefinition = taskDefinition;
	}

	@Override
	public Type<TaskPreviewOpenedHandler> getAssociatedType() {
		return TYPE;
	}

	public TaskDefinition getTaskDefinition() {
		return taskDefinition;
	}

	public void setTaskDefinition(TaskDefinition taskDefinition) {
		this.taskDefinition = taskDefinition;
	}

	@Override
	protected void dispatch(TaskPreviewOpenedHandler handler) {
		handler.onTaskPreviewOpened(this);
	}
}
